package com.tsh.erp.dao.hibernate.hibernate4;

import org.springframework.stereotype.Repository;
import kiven.jee.dao.hibernate.hibernate4.BaseHibernateDao;

import com.tsh.erp.dao.UserDao;
import com.tsh.erp.model.User;

@Repository("userDao")
public class UserDaoHibernateImpl extends BaseHibernateDao<User, String> implements
		UserDao {
	private final String LOGIN_HQL = "from User u where u.userid = ? and u.password = ?";
	
	@Override
	public User login(String userid,String password) {
		User user = findUniqueByHql(LOGIN_HQL, userid,password);
		
		return user;
	}
	
	@Override
	public User findUserByPropertyName(String propertyName,Object propertyValue) {
		return findUniqueByProperty(propertyName,propertyValue);
	}

}
